package online.misscl.hello.auto;

import com.sun.org.apache.regexp.internal.RE;
import online.misscl.hello.bean.HelloProperties;
import online.misscl.hello.service.HelloService;
import online.misscl.hello.util.CodeUtil;
import online.misscl.hello.util.UUIDUtil;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * project name: IntelliJ IDEA
 * Date: 2022/9/26 22:37
 *
 * @PackageName: online.misscl.hello.auto
 * @ClassName: HelloServiceAutoConfiguration
 * @Author: Theo
 * @Version:
 * @Description:
 */
@Configuration
@EnableConfigurationProperties(HelloProperties.class) //默认放在容器中
public class HelloServiceAutoConfiguration {
    @ConditionalOnMissingBean(HelloService.class)
    @Bean
    public HelloService helloService(){
        HelloService helloService = new HelloService();
        return helloService;
    }

    @ConditionalOnMissingBean(CodeUtil.class)
    @Bean
    public CodeUtil codeUtil(){
        return new CodeUtil();
    }

    @ConditionalOnMissingBean(UUIDUtil.class)
    @Bean
    public UUIDUtil uUIDUtil(){
        return new UUIDUtil();
    }


}
